package ljl.alg.jianzhioffer.round3.medium;

public class _63_maxProfit {

    public int maxProfit(int[] prices) {
        if (prices.length == 0) return 0;
        int min = prices[0], max = 0;
        for (int price : prices) {
            min = Math.min(price, min);
            max = Math.max(max, price - min);
        }
        return max;
    }
}
